--drop table bdap_dept;
CREATE TABLE bdap_dept (
  id number(11) ,
  num number(11),
  pid number(11),
  pids varchar2(255),
  simplename varchar2(45),
  fullname varchar2(255),
  tips varchar2(255),
  version number(11),
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_dept.id IS '主键id';
COMMENT ON COLUMN bdap_dept.num IS '排序';
COMMENT ON COLUMN bdap_dept.pid IS '父部门id';
COMMENT ON COLUMN bdap_dept.pids IS '父级ids';
COMMENT ON COLUMN bdap_dept.simplename IS '简称';
COMMENT ON COLUMN bdap_dept.fullname IS '全称';
COMMENT ON COLUMN bdap_dept.tips IS '提示';
COMMENT ON COLUMN bdap_dept.version IS '版本（乐观锁保留字段）';

--drop table bdap_dict;
CREATE TABLE bdap_dict (
  id number(11) generated by default as identity(start with 100000 increment by 1),
  num number(11),
  pid number(11),
  name varchar2(255),
  tips varchar2(255),
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_dict.id IS '主键id';
COMMENT ON COLUMN bdap_dict.num IS '排序';
COMMENT ON COLUMN bdap_dict.pid IS '父级字典';
COMMENT ON COLUMN bdap_dict.name IS '名称';
COMMENT ON COLUMN bdap_dict.tips IS '提示';

--drop table bdap_login_log;
CREATE TABLE bdap_login_log (
  id number(11) generated by default as identity(start with 200000 increment by 1),
  logname varchar2(255),
  userid number(11),
  createtime DATE,
  succeed varchar2(255),
  message CLOB,
  ip varchar2(255),
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_login_log.id IS '主键';
COMMENT ON COLUMN bdap_login_log.logname IS '日志名称';
COMMENT ON COLUMN bdap_login_log.userid IS '管理员id';
COMMENT ON COLUMN bdap_login_log.createtime IS '创建时间';
COMMENT ON COLUMN bdap_login_log.succeed IS '是否执行成功';
COMMENT ON COLUMN bdap_login_log.message IS '具体消息';
COMMENT ON COLUMN bdap_login_log.ip IS '登录ip';

--drop table bdap_menu;
CREATE TABLE bdap_menu (
  id number(11) generated by default as identity(start with 300000 increment by 1),
  code varchar2(255),
  pcode varchar2(255),
  pcodes varchar2(255),
  name varchar2(255),
  icon varchar2(255),
  url varchar2(255),
  num number(11),
  levels number(11),
  ismenu number(11),
  tips varchar2(255),
  status number(11),
  isopen number(11),
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_menu.id IS '主键id';
COMMENT ON COLUMN bdap_menu.code IS '菜单编号';
COMMENT ON COLUMN bdap_menu.pcode IS '菜单父编号';
COMMENT ON COLUMN bdap_menu.pcodes IS '当前菜单的所有父菜单编号';
COMMENT ON COLUMN bdap_menu.name IS '菜单名称';
COMMENT ON COLUMN bdap_menu.icon IS '菜单图标';
COMMENT ON COLUMN bdap_menu.url IS 'url地址';
COMMENT ON COLUMN bdap_menu.num IS '菜单排序号';
COMMENT ON COLUMN bdap_menu.levels IS '菜单层级';
COMMENT ON COLUMN bdap_menu.ismenu IS '是否是菜单（1：是  0：不是）';
COMMENT ON COLUMN bdap_menu.tips IS '备注';
COMMENT ON COLUMN bdap_menu.status IS '菜单状态 :  1:启用   0:不启用';
COMMENT ON COLUMN bdap_menu.isopen IS '是否打开:    1:打开   0:不打开';

--drop table bdap_notice;
CREATE TABLE bdap_notice (
  id number(11) generated by default as identity(start with 400000 increment by 1),
  title varchar2(255) ,
  type number(11) ,
  content CLOB ,
  createtime DATE ,
  creater number(11) ,
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_notice.id IS '主键';
COMMENT ON COLUMN bdap_notice.title IS '标题';
COMMENT ON COLUMN bdap_notice.type IS '类型';
COMMENT ON COLUMN bdap_notice.content IS '内容';
COMMENT ON COLUMN bdap_notice.createtime IS '创建时间';
COMMENT ON COLUMN bdap_notice.creater IS '创建人';

--drop table bdap_operation_log;
CREATE TABLE bdap_operation_log (
  id number(11) generated by default as identity(start with 500000 increment by 1),
  logtype varchar2(255) ,
  logname varchar2(255) ,
  userid number(11) ,
  classname varchar2(255) ,
  method CLOB ,
  createtime DATE  ,
  succeed varchar2(255) ,
  message CLOB ,
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_operation_log.id IS '主键';
COMMENT ON COLUMN bdap_operation_log.logtype IS '日志类型';
COMMENT ON COLUMN bdap_operation_log.logname IS '日志名称';
COMMENT ON COLUMN bdap_operation_log.userid IS '用户id';
COMMENT ON COLUMN bdap_operation_log.classname IS '类名称';
COMMENT ON COLUMN bdap_operation_log.method IS '方法名称';
COMMENT ON COLUMN bdap_operation_log.createtime IS '创建时间';
COMMENT ON COLUMN bdap_operation_log.succeed IS '是否成功';
COMMENT ON COLUMN bdap_operation_log.message IS '备注';

--drop table bdap_relation;
CREATE TABLE bdap_relation (
  id number(11) generated by default as identity(start with 600000 increment by 1),
  menuid number(11) ,
  roleid number(11) ,
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_relation.id IS '主键';
COMMENT ON COLUMN bdap_relation.menuid IS '菜单id';
COMMENT ON COLUMN bdap_relation.roleid IS '角色id';

--drop table bdap_role;
CREATE TABLE bdap_role (
  id number(11)  ,
  num number(11) ,
  pid number(11) ,
  name varchar2(255) ,
  deptid number(11) ,
  tips varchar2(255) ,
  version number(11) ,
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_role.id IS '主键id';
COMMENT ON COLUMN bdap_role.num IS '序号';
COMMENT ON COLUMN bdap_role.pid IS '父角色id';
COMMENT ON COLUMN bdap_role.name IS '角色名称';
COMMENT ON COLUMN bdap_role.deptid IS '部门名称';
COMMENT ON COLUMN bdap_role.tips IS '提示';
COMMENT ON COLUMN bdap_role.version IS '保留字段(暂时没用）';

--drop table bdap_user;
CREATE TABLE bdap_user (
  id number(11) ,
  avatar varchar2(255) ,
  account varchar2(45)  ,
  password varchar2(45) ,
  salt varchar2(45)  ,
  name varchar2(45) ,
  birthday DATE  ,
  sex number(11) ,
  email varchar2(45) ,
  phone varchar2(45) ,
  roleid varchar2(255) ,
  deptid number(11) ,
  status number(11) ,
  createtime DATE ,
  version number(11) ,
  PRIMARY KEY (id)
);

COMMENT ON COLUMN bdap_user.id IS '主键id';
COMMENT ON COLUMN bdap_user.avatar IS '头像';
COMMENT ON COLUMN bdap_user.account IS '账号';
COMMENT ON COLUMN bdap_user.password IS '密码';
COMMENT ON COLUMN bdap_user.salt IS 'md5密码盐';
COMMENT ON COLUMN bdap_user.name IS '名字';
COMMENT ON COLUMN bdap_user.birthday IS '生日';
COMMENT ON COLUMN bdap_user.sex IS '性别（1：男 2：女）';
COMMENT ON COLUMN bdap_user.email IS '电子邮件';
COMMENT ON COLUMN bdap_user.phone IS '电话';
COMMENT ON COLUMN bdap_user.roleid IS '角色id';
COMMENT ON COLUMN bdap_user.deptid IS '部门id';
COMMENT ON COLUMN bdap_user.status IS '状态(1：启用  2：冻结  3：删除）';
COMMENT ON COLUMN bdap_user.createtime IS '创建时间';
COMMENT ON COLUMN bdap_user.version IS '保留字段';

--创建IP白名单表 by xiongyao 20171116

CREATE TABLE BDAP_WHITEIP_LIST
(
  IP   VARCHAR2(2000 BYTE),
  NAME VARCHAR2(2000 BYTE),
  ID   NUMBER
); 
COMMENT ON COLUMN BDAP_WHITEIP_LIST.IP IS 'IP';
COMMENT ON COLUMN BDAP_WHITEIP_LIST.NAME IS '名称';

CREATE SEQUENCE BDAP_IP_ID  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER  NOCYCLE  ;

CREATE OR REPLACE TRIGGER BDAP_IPLIST_TRG 
before INSERT ON BDAP_WHITEIP_LIST 
  FOR EACH row 
  BEGIN 
    IF inserting THEN 
      IF :NEW.ID IS NULL THEN
        SELECT BDAP_IP_ID.nextval INTO :NEW.ID FROM dual;
      END IF;
    END IF;
  END;
/

ALTER TRIGGER BDAP_IPLIST_TRG ENABLE;

--李琪 20171116
--区域管理表
--drop table bdap_area;
CREATE TABLE bdap_area (
  id number(20) ,
  userid number(20) ,
  city varchar2(100) ,
  district varchar2(100) ,
  name varchar2(100) ,
  type varchar2(100) ,
  description clob,
  lon varchar2(100) ,
  lat varchar2(100) ,
  warning_value number(20) ,
  saturation_value number(20) ,
  severe_value number(20),
  GROUP_AREAID VARCHAR2(100)
);

COMMENT ON COLUMN bdap_area.id IS '主键id';
COMMENT ON COLUMN bdap_area.userid IS '用户id';
COMMENT ON COLUMN bdap_area.city IS '地市';
COMMENT ON COLUMN bdap_area.district IS '区县';
COMMENT ON COLUMN bdap_area.name IS '区域名称';
COMMENT ON COLUMN bdap_area.type IS '类型';
COMMENT ON COLUMN bdap_area.description IS '描述';
COMMENT ON COLUMN bdap_area.lon IS '经度';
COMMENT ON COLUMN bdap_area.lat IS '纬度';
COMMENT ON COLUMN bdap_area.warning_value IS '警戒值';
COMMENT ON COLUMN bdap_area.saturation_value IS '饱和值';
COMMENT ON COLUMN bdap_area.severe_value IS '严重值';
comment on column BDAP_AREA.GROUP_AREAID is '集团区域ID';

--子区域管理表
--drop table bdap_sub_area;
CREATE TABLE bdap_sub_area (
  id number(20) ,
  pid number(20) ,
  userid number(20) ,
  name varchar2(100) ,
  lon_lat clob,
  warning_value number(20) ,
  saturation_value number(20) ,
  severe_value number(20),
  lac_ci clob
);

COMMENT ON COLUMN bdap_sub_area.id IS '主键id';
COMMENT ON COLUMN bdap_sub_area.pid IS '区域id';
COMMENT ON COLUMN bdap_sub_area.userid IS '用户id';
COMMENT ON COLUMN bdap_sub_area.name IS '子区域名称';
COMMENT ON COLUMN bdap_sub_area.lon_lat IS '经纬度';
COMMENT ON COLUMN bdap_sub_area.warning_value IS '警戒值';
COMMENT ON COLUMN bdap_sub_area.saturation_value IS '饱和值';
COMMENT ON COLUMN bdap_sub_area.severe_value IS '严重值';
COMMENT ON COLUMN bdap_sub_area.lac_ci IS 'lacci集合';

--基站参数表
--drop table bdap_cell_info_month;
CREATE TABLE bdap_cell_info_month (
  city_name varchar2(100),
  district_name varchar2(100),
  lac varchar2(100),
  ci varchar2(100),
  cell_name varchar2(100),
  lon varchar2(100),
  lat varchar2(100),
  time varchar2(100)
);

COMMENT ON COLUMN bdap_cell_info_month.city_name IS '地市';
COMMENT ON COLUMN bdap_cell_info_month.district_name IS '区县';
COMMENT ON COLUMN bdap_cell_info_month.lac IS 'lac';
COMMENT ON COLUMN bdap_cell_info_month.ci IS 'ci';
COMMENT ON COLUMN bdap_cell_info_month.cell_name IS '小区名称';
COMMENT ON COLUMN bdap_cell_info_month.lon IS '经度';
COMMENT ON COLUMN bdap_cell_info_month.lat IS '纬度';
COMMENT ON COLUMN bdap_cell_info_month.time IS '时间';

--地市区县维表
--drop table bdap_city_district;
create table bdap_city_district (
  city varchar2(100) ,
  district varchar2(100)
);
 
COMMENT ON COLUMN bdap_city_district.city IS '地市';
COMMENT ON COLUMN bdap_city_district.district IS '区县';

--用户区域表
--drop table bdap_user_area;
create table bdap_user_area (
  userid number(20) ,
  areaid number(20) ,
  is_important number(20) ,
  state number(20)
);

COMMENT ON COLUMN bdap_user_area.userid IS '用户id';
COMMENT ON COLUMN bdap_user_area.areaid IS '区域id';
COMMENT ON COLUMN bdap_user_area.is_important IS '是否关注（1：关注 0：不关注）';
COMMENT ON COLUMN bdap_user_area.state IS '状态（1：审批中 2：已完成 3：已失效）';

--区域序列
CREATE SEQUENCE  BDAP_AREA_ID_SEQ  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 ORDER NOCYCLE;

--区域触发器
CREATE OR REPLACE TRIGGER BDAP_AREA_TRG 
before
INSERT ON BDAP_AREA FOR EACH row 
BEGIN 
    IF inserting THEN 
        IF :NEW.ID IS NULL THEN
            SELECT BDAP_AREA_ID_SEQ.nextval INTO :NEW.ID FROM dual;
        END IF;
    END IF;   
END;
/

--子区域触发器
CREATE OR REPLACE TRIGGER BDAP_SUB_AREA_TRG 
before
INSERT ON BDAP_SUB_AREA FOR EACH row 
BEGIN 
    IF inserting THEN 
      IF :NEW.ID IS NULL THEN
          SELECT BDAP_AREA_ID_SEQ.nextval INTO :NEW.ID FROM dual;
        END IF;
    END IF;
END;
/

CREATE SEQUENCE  BDAP_SYSTEM_ID_SEQ  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 ORDER NOCYCLE;

--用户触发器
CREATE OR REPLACE TRIGGER BDAP_USER_TRG 
before
INSERT ON BDAP_USER FOR EACH row 
BEGIN 
    IF inserting THEN 
        IF :NEW.ID IS NULL THEN
          SELECT BDAP_SYSTEM_ID_SEQ.nextval INTO :NEW.ID FROM dual;
        END IF;
    END IF;
END;
/

--部门触发器
CREATE OR REPLACE TRIGGER BDAP_DEPT_TRG 
before
  INSERT ON BDAP_DEPT FOR EACH row 
  BEGIN 
    IF inserting THEN 
      IF :NEW.ID IS NULL THEN
        SELECT BDAP_SYSTEM_ID_SEQ.nextval INTO :NEW.ID FROM dual;
      END IF;
    END IF;
END;
/

--角色触发器
CREATE OR REPLACE TRIGGER BDAP_ROLE_TRG 
before
  INSERT ON BDAP_ROLE FOR EACH row 
  BEGIN 
    IF inserting THEN 
      IF :NEW.ID IS NULL THEN
        SELECT BDAP_SYSTEM_ID_SEQ.nextval INTO :NEW.ID FROM dual;
      END IF;
    END IF;
END;
/

ALTER TRIGGER BDAP_AREA_TRG ENABLE;

ALTER TRIGGER BDAP_SUB_AREA_TRG ENABLE;

ALTER TRIGGER BDAP_USER_TRG ENABLE;

ALTER TRIGGER BDAP_DEPT_TRG ENABLE;

ALTER TRIGGER BDAP_ROLE_TRG ENABLE;

--区域类型
CREATE TABLE bdap_area_type (
  id number(11)  generated by default as identity(start with 700000 increment by 1) ,
  type varchar2(45)
);

COMMENT ON COLUMN bdap_area_type.id IS '区域id';
COMMENT ON COLUMN bdap_area_type.type IS '区域类型';

 --基站15分钟级人流属性模型  add by xiongyao 20171123
CREATE TABLE BDAP_LACCI_POP_PROP_QM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  TOTAL_USERS varchar2(100),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS varchar2(1000),
  STAY_LOCAL_USERS varchar2(100),
  WORK_LOCAL_USERS varchar2(100),
  TERM_BRAND_USERS clob,
  ARPU_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100),
  STAT_HOUR varchar2(100),
  STAT_MINUTES varchar2(100)
);

COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.LAC_HEX_CODE IS 'LAC十六进制编码';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.CI_HEX_CODE IS 'CI十六进制编码';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.STAT_DATE IS '日分区';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.STAT_HOUR IS '小时分区';
COMMENT ON COLUMN BDAP_LACCI_POP_PROP_QM.STAT_MINUTES IS '分钟分区';

--区域15分钟级人流属性模型 add by xiongyao 20171123
CREATE TABLE BDAP_AREA_POP_PROP_QM (
  AREAID varchar2(100),
  AREATYPE varchar2(100),
  AREANAME varchar2(100),
  AREA_SUBTYPE varchar2(100),
  TOTAL_USERS varchar2(100),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS varchar2(1000),
  STAY_LOCAL_USERS varchar2(100),
  WORK_LOCAL_USERS varchar2(100),
  TERM_BRAND_USERS clob,
  ARPU_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100),
  STAT_HOUR varchar2(100),
  STAT_MINUTES varchar2(100)
);

COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.AREAID IS '区域ID';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.AREATYPE IS '区域类型';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.AREANAME IS '区域名称';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.AREA_SUBTYPE IS '区域子类';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.STAT_DATE IS '日分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.STAT_HOUR IS '小时分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_QM.STAT_MINUTES IS '分钟分区';

--区域小时级人流属性模型 add by xiongyao 20171123
CREATE TABLE BDAP_AREA_POP_PROP_HM (
  AREAID varchar2(100),
  AREATYPE varchar2(100),
  AREANAME varchar2(100),
  AREA_SUBTYPE varchar2(100),
  TOTAL_USERS varchar2(100),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS varchar2(1000),
  STAY_LOCAL_USERS varchar2(100),
  WORK_LOCAL_USERS varchar2(100),
  TERM_BRAND_USERS clob,
  ARPU_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100),
  STAT_HOUR varchar2(100)
);

COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.AREAID IS '区域ID';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.AREATYPE IS '区域类型';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.AREANAME IS '区域名称';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.AREA_SUBTYPE IS '区域子类';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.STAT_DATE IS '日分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_HM.STAT_HOUR IS '小时分区';

--区域天级人流属性模型 add by xiongyao 20171123
CREATE TABLE BDAP_AREA_POP_PROP_DM (
  AREAID varchar2(100),
  AREATYPE varchar2(100),
  AREANAME varchar2(100),
  AREA_SUBTYPE varchar2(100),
  TOTAL_USERS varchar2(100),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS varchar2(1000),
  STAY_LOCAL_USERS varchar2(100),
  WORK_LOCAL_USERS varchar2(100),
  TERM_BRAND_USERS clob,
  ARPU_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100)
);

COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.AREAID IS '区域ID';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.AREATYPE IS '区域类型';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.AREANAME IS '区域名称';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.AREA_SUBTYPE IS '区域子类';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DM.STAT_DATE IS '日分区';

--区域周级人流属性模型 add by xiongyao 20171123
CREATE TABLE BDAP_AREA_POP_PROP_WT (
  AREAID varchar2(100),
  AREATYPE varchar2(100),
  AREANAME varchar2(100),
  AREA_SUBTYPE varchar2(100),
  TOTAL_USERS varchar2(100),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS varchar2(1000),
  STAY_LOCAL_USERS varchar2(100),
  WORK_LOCAL_USERS varchar2(100),
  TERM_BRAND_USERS clob,
  ARPU_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100)
);

COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.AREAID IS '区域ID';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.AREATYPE IS '区域类型';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.AREANAME IS '区域名称';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.AREA_SUBTYPE IS '区域子类';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_WT.STAT_DATE IS '日分区';

--区域月级人流属性模型 add by xiongyao 20171123
CREATE TABLE BDAP_AREA_POP_PROP_DT (
  AREAID varchar2(100),
  AREATYPE varchar2(100),
  AREANAME varchar2(100),
  AREA_SUBTYPE varchar2(100),
  TOTAL_USERS varchar2(100),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS varchar2(1000),
  STAY_LOCAL_USERS varchar2(100),
  WORK_LOCAL_USERS varchar2(100),
  TERM_BRAND_USERS clob,
  ARPU_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100)
);

COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.AREAID IS '区域ID';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.AREATYPE IS '区域类型';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.AREANAME IS '区域名称';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.AREA_SUBTYPE IS '区域子类';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_AREA_POP_PROP_DT.STAT_DATE IS '日分区';



--景区监控（日） add by zhangyaoyao 20171129
CREATE TABLE BDAP_TRACE_DAY (	
  ID NUMBER, 
  TIME DATE, 
  PEAK_ALL_PERSON NUMBER(*,0), 
  PEAK_FLUID_PERSON NUMBER(*,0), 
  CUMULATIVE_ALL_PERSON NUMBER(*,0), 
  CUMULATIVE_FLUID_PERSON NUMBER(*,0), 
  TERMINAL_BRAND CLOB, 
  MONTHLY_CONSUMPTION CLOB, 
  ORIGIN_PERSON_PROVINCE CLOB, 
  ORIGIN_PERSON_CITY CLOB, 
  NATIVE_PERSON_PROVINCE CLOB, 
  NATIVE_PERSON_CITY CLOB, 
  SEX CLOB, 
  AGE_PERSON CLOB
);
   
COMMENT ON COLUMN BDAP_TRACE_DAY.ID IS '区域id';
COMMENT ON COLUMN BDAP_TRACE_DAY.PEAK_ALL_PERSON IS '所有峰值客流数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.PEAK_FLUID_PERSON IS '流动峰值客流数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.CUMULATIVE_ALL_PERSON IS '所有累计客流数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.CUMULATIVE_FLUID_PERSON IS '流动累计客流数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.TERMINAL_BRAND IS '终端分布数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.MONTHLY_CONSUMPTION IS '月消费分布数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.ORIGIN_PERSON_PROVINCE IS '客源地数据(省份）';
COMMENT ON COLUMN BDAP_TRACE_DAY.ORIGIN_PERSON_CITY IS '客源地数据(城市）';
COMMENT ON COLUMN BDAP_TRACE_DAY.NATIVE_PERSON_PROVINCE IS '籍贯数据省份（省份）';
COMMENT ON COLUMN BDAP_TRACE_DAY.NATIVE_PERSON_CITY IS '籍贯数据分布（城市）';
COMMENT ON COLUMN BDAP_TRACE_DAY.SEX IS '性别分布数据';
COMMENT ON COLUMN BDAP_TRACE_DAY.AGE_PERSON IS '年龄分布数据';


--景区监控（天） add by zhangyaoyao 20171129
CREATE TABLE BDAP_TRACE_DAYTIME(	
    ID NUMBER, 
    TIME DATE, 
	STAY_SITUATION NUMBER(*,0), 
	PASSENGE_DENSITY_PERSON NUMBER(*,0), 
	PASSING_PERSON NUMBER(*,0), 
	TRAVLE_PERSON NUMBER(*,0)
);

COMMENT ON COLUMN BDAP_TRACE_DAYTIME.ID IS '区域id';
COMMENT ON COLUMN BDAP_TRACE_DAYTIME.TIME IS '时间';
COMMENT ON COLUMN BDAP_TRACE_DAYTIME.STAY_SITUATION IS '逗留情况数据';
COMMENT ON COLUMN BDAP_TRACE_DAYTIME.PASSENGE_DENSITY_PERSON IS '客流密度(客流人数据）';
COMMENT ON COLUMN BDAP_TRACE_DAYTIME.PASSING_PERSON IS '途经人口数据';
COMMENT ON COLUMN BDAP_TRACE_DAYTIME.TRAVLE_PERSON IS '出行人口数据';

--景区监控（小时） add by zhangyaoyao 20171129
CREATE TABLE BDAP_TRACE_HOUR (	
    ID NUMBER, 
	TIME DATE, 
	STAY_SITUATION NUMBER(*,0), 
	PASSENGE_DENSITY_PERSON NUMBER(*,0), 
	PASSING_PERSON NUMBER(*,0), 
	TRAVLE_PERSON NUMBER(*,0)
);

COMMENT ON COLUMN BDAP_TRACE_HOUR.ID IS '区域id';
COMMENT ON COLUMN BDAP_TRACE_HOUR.TIME IS '时间';
COMMENT ON COLUMN BDAP_TRACE_HOUR.STAY_SITUATION IS '逗留情况数据';
COMMENT ON COLUMN BDAP_TRACE_HOUR.PASSENGE_DENSITY_PERSON IS '客流密度(客流人数据）';
COMMENT ON COLUMN BDAP_TRACE_HOUR.PASSING_PERSON IS '途经人口数据';
COMMENT ON COLUMN BDAP_TRACE_HOUR.TRAVLE_PERSON IS '出行人口数据';

--景区监控（月） add by zhangyaoyao 20171129
CREATE TABLE BDAP_TRACE_MONTH (	
	ID NUMBER, 
	TIME DATE, 
	PEAK_ALL_PERSON NUMBER(*,0), 
	PEAK_FLUID_PERSON NUMBER(*,0), 
	CUMULATIVE_ALL_PERSON NUMBER(*,0), 
	CUMULATIVE_FLUID_PERSON NUMBER(*,0), 
	PERMANENT_PEOPLE NUMBER(*,0), 
	WORKFORCE_PEOPLE NUMBER(*,0), 
	LOYALTY_DEGREE NUMBER(*,0), 
	SEX CLOB, 
	AGE_PERSON CLOB
);

COMMENT ON COLUMN BDAP_TRACE_MONTH.ID IS '区域id';
COMMENT ON COLUMN BDAP_TRACE_MONTH.TIME IS '时间';
COMMENT ON COLUMN BDAP_TRACE_MONTH.PEAK_ALL_PERSON IS '所有峰值客流数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.PEAK_FLUID_PERSON IS '流动峰值客流数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.CUMULATIVE_ALL_PERSON IS '所有累计客流数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.CUMULATIVE_FLUID_PERSON IS '流动累计客流数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.PERMANENT_PEOPLE IS '常驻人口数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.WORKFORCE_PEOPLE IS '工作人口数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.LOYALTY_DEGREE IS '忠诚度数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.SEX IS '性别分布数据';
COMMENT ON COLUMN BDAP_TRACE_MONTH.AGE_PERSON IS '年龄分布数据';

--小区小时级人流属性模型 add by liqi 20171202
CREATE TABLE BDAP_CELL_POP_PROP_HM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  TOTAL_USERS number(20),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS clob,
  STAY_LOCAL_USERS number(20),
  WORK_LOCAL_USERS number(20),
  TERM_BRAND_USERS clob,
  ARPU_USERS clob,
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100),
  STAT_HOUR varchar2(100)
);

COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.STAT_DATE IS '日分区';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_HM.STAT_HOUR IS '小时分区';

--小区天级人流属性模型 add by liqi 20171202
CREATE TABLE BDAP_CELL_POP_PROP_DM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  TOTAL_USERS number(20),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS clob,
  STAY_LOCAL_USERS number(20),
  WORK_LOCAL_USERS number(20),
  TERM_BRAND_USERS clob,
  ARPU_USERS clob,
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100),
  HOMETOWNS_PROVINCE_USERS clob,
  HOMETOWNS_CITY_USERS clob
);

COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.STAT_DATE IS '日分区';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.HOMETOWNS_PROVINCE_USERS IS '籍贯分布（省）用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DM.HOMETOWNS_CITY_USERS IS '籍贯分布（城市）用户数';

--小区天累计级人流属性模型 add by liqi 20171202
CREATE TABLE BDAP_CELL_POP_PROP_DT (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  TOTAL_USERS number(20),
  SEX_USERS varchar2(100),
  AGE_USERS varchar2(1000),
  SN_CITY_USERS varchar2(1000),
  SW_CITY_USERS clob,
  PROVINCE_USERS clob,
  STAY_LOCAL_USERS number(20),
  WORK_LOCAL_USERS number(20),
  TERM_BRAND_USERS clob,
  ARPU_USERS clob,
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100)
);

COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.TOTAL_USERS IS '移动手机用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.SEX_USERS IS '用户性别分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.AGE_USERS IS '用户年龄段分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.SN_CITY_USERS IS '（省内）用户地市分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.SW_CITY_USERS IS '（省外）外地客源分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.PROVINCE_USERS IS '用户省份分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.STAY_LOCAL_USERS IS '常驻人口用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.WORK_LOCAL_USERS IS '工作人口用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.TERM_BRAND_USERS IS '终端品牌分布数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.ARPU_USERS IS 'ARPU值分布用户数';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_CELL_POP_PROP_DT.STAT_DATE IS '日分区';

--小区常驻用户数统计月表 add by liqi 20171202
CREATE TABLE BDAP_CELL_RISIDENT_MM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  STAY_LOCAL_USERS number(20),
  WORK_LOCAL_USERS number(20),
  STAT_MONTH varchar2(100)
);

COMMENT ON COLUMN BDAP_CELL_RISIDENT_MM.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_RISIDENT_MM.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_RISIDENT_MM.STAY_LOCAL_USERS IS '常驻用户数';
COMMENT ON COLUMN BDAP_CELL_RISIDENT_MM.WORK_LOCAL_USERS IS '工作用户数';
COMMENT ON COLUMN BDAP_CELL_RISIDENT_MM.STAT_MONTH IS '月分区';

--区域小区关系表 add by liqi 20171202
CREATE TABLE BDAP_AREA_CELL_REF (
  AREAID number(20),
  SUB_AREAID number(20),
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100)
);

COMMENT ON COLUMN BDAP_AREA_CELL_REF.AREAID IS '区域ID';
COMMENT ON COLUMN BDAP_AREA_CELL_REF.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_AREA_CELL_REF.CI_HEX_CODE IS 'CI';


--创建小区表索引 add by liqi 20171204
CREATE INDEX BDAP_CELL_POP_PROP_HM_INDEX ON BDAP_CELL_POP_PROP_HM(LAC_HEX_CODE,CI_HEX_CODE);
CREATE INDEX BDAP_CELL_POP_PROP_DM_INDEX ON BDAP_CELL_POP_PROP_DM(LAC_HEX_CODE,CI_HEX_CODE);
CREATE INDEX BDAP_CELL_POP_PROP_DT_INDEX ON BDAP_CELL_POP_PROP_DT(LAC_HEX_CODE,CI_HEX_CODE);
CREATE INDEX BDAP_AREA_CELL_REF_INDEX ON BDAP_AREA_CELL_REF(LAC_HEX_CODE,CI_HEX_CODE);
CREATE INDEX BDAP_CELL_RISIDENT_MM_INDEX ON BDAP_CELL_RISIDENT_MM(LAC_HEX_CODE,CI_HEX_CODE);


--小区天级逗留情况 add by zhangyaoyao 20180110
CREATE TABLE ULTRAPAPP.BDAP_CELL_STAY_DM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  STAY_TIME_USERS varchar2(1000),
  STAT_MONTH varchar2(100),
  STAT_DATE varchar2(100)
);

COMMENT ON COLUMN BDAP_CELL_STAY_DM.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_STAY_DM.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_STAY_DM.STAY_TIME_USERS IS '逗留小时分布用户数';
COMMENT ON COLUMN BDAP_CELL_STAY_DM.STAT_MONTH IS '月分区';
COMMENT ON COLUMN BDAP_CELL_STAY_DM.STAT_DATE IS '日分区';

--小区月级逗留情况 add by zhangyaoyao 20180110
CREATE TABLE ULTRAPAPP.BDAP_CELL_STAY_MM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  STAY_TIME_USERS varchar2(1000),
  STAT_MONTH varchar2(100)
);

COMMENT ON COLUMN BDAP_CELL_STAY_MM.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_STAY_MM.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_STAY_MM.STAY_TIME_USERS IS '逗留天数分布用户数';
COMMENT ON COLUMN BDAP_CELL_STAY_MM.STAT_MONTH IS '月分区';


--小区月级忠诚度情况  add by zhangyaoyao 20180110
CREATE TABLE ULTRAPAPP.BDAP_CELL_LOYALTY_MM (
  LAC_HEX_CODE varchar2(100),
  CI_HEX_CODE varchar2(100),
  VISIT_USERS varchar2(1000),
  STAT_MONTH varchar2(100)
);

COMMENT ON COLUMN BDAP_CELL_LOYALTY_MM.LAC_HEX_CODE IS 'LAC';
COMMENT ON COLUMN BDAP_CELL_LOYALTY_MM.CI_HEX_CODE IS 'CI';
COMMENT ON COLUMN BDAP_CELL_LOYALTY_MM.VISIT_USERS IS '到访次数分布用户数';
COMMENT ON COLUMN BDAP_CELL_LOYALTY_MM.STAT_MONTH IS '月分区';


--用户表新增有效期字段  add by xiongya0 29180329
ALTER TABLE BDAP_USER ADD (EXPDATE DATE);
COMMENT ON COLUMN BDAP_USER.EXPDATE IS '有效期';